<!DOCTYPE html>
<html lang="en">
<head>
[#include "/customer/include/static.htm"]
    <link href="${path}/resources/css/user.css?v=2" rel="stylesheet" type="text/css"/>
    <link href="${path}/resources/plug/layui/css/layui.css" rel="stylesheet" type="text/css"/>
    <style type="text/css">
        option {
            font-size: 14px;
            line-height: 20px;
        }
    </style>

[#import "/customer/include/pagination.ftl" as p/]
</head>
<body>
<!--头部-->
[#include "/customer/include/header.ftl"]
<script type="text/javascript">
    layui.use(['form','layer'], function(){
        var form = layui.form(), $=layui.jquery, layer = layui.layer;});
    function repaymentMoney(loan_id) {
        // var borrowId = $("#borrowId").val();
        layer.confirm("确认还款吗?还款需要一段时间,请不要关闭浏览器",function(){

            ajax({
                type : "post",
                url : "${path}/member/repayment/payloan",
                data : {
                    "loan_id" : loan_id
                },
                complete : function() {

                },
                success : function(data) {

                    if (data.error == undefined || data.error == '') {
                        layer.msg("还款成功",function(){
                            location.reload();

                        });

                    } else {
                        layer.msg(data.error);
                        if (data.showCode) {
                            refreshCaptcha();
                            $(".showcode").show();
                        }
                        flag = false;
                    }
                }
            });

        });
    }
</script>

<div class="member">
    <!--左边-->
[#include "/customer/include/member_left_menu.ftl"]
    <!--左边 end-->
    <div class="memberRight">
        <div class="member_tab">
            <div class="member_tab">
                <a href="/member/bid/stay"  [#if !billStatus??] class="on" [/#if]>我的借款账单</a>
                <a href="/member/bid/stay?billStatus=0" [#if billStatus==0] class="on" [/#if]>未还款</a>
                <a href="/member/bid/stay?billStatus=1" [#if billStatus==1] class="on" [/#if]>已还款</a>
            </div>
        </div>
        <div class="member_tab_info">
            <table class="layui-table">
                <colgroup>
                    <col width="100">
                    <col width="100">
                    <col width="100">

                    <col width="100">
                    <col width="100">
                    <col width="100">
                </colgroup>
                <thead>
                <tr >

                    <th>项目名称</th>
                    <th>还款方式</th>
                    <th>待还本金</th>
                    <th>待还利息</th>
                    <th>待还时间</th>
                    <th>状态</th>
                </tr>
                </thead>
                <tbody>
                [#if repayments?? && repayments?size > 0]
                    [#list repayments as repayment]
                    <tr style="position: relative;">

                        <td>${repayment.name }-第${repayment.r_stay_periods }/${repayment.repayment_periods }期</td>

                        <td>
                        ${p2p_get_dict("borrow_style",repayment.pay_style)}
                        </td>



                        <td>￥${repayment.r_stay_capital }</td>
                        <td >￥${repayment.r_stay_interest}</td>
                        <td>
                        ${p2p_date_format(repayment.r_stay_time,"yyyy-MM-dd HH:mm:ss")}
                        </td>
                        <td  >
                            [#if repayment.r_stay_status==0 ]
                                <a href="#" onclick="repaymentMoney('${repayment.id}');" style="color:#ff8e3a;text-decoration: none;">还款</a>
                            [#elseif repayment.r_stay_status==1 ]
                                已还完
                            [/#if]
                        </td>
                    </tr>
                    [/#list]
                [#else]
                <tr>
                    <td id="tbody" style="background: #fff" colspan="11"><div class="nodataimg"></div></td>
                </tr>
                [/#if]

                </tbody>
            </table>
        [@p.pager pager = page  url = "${path}/member/bid/stay"/]


        </div>
    </div>
</div>
<script type="text/javascript" src="${path}/resources/plug/layui/layui.js"></script>

[#include "/customer/include/footer.ftl"]
</body>
</html>